package com.ewanghuiju.app.ui.home.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewanghuiju.app.R;
import com.ewanghuiju.app.component.ImageLoader;
import com.ewanghuiju.app.model.bean.local.Bibeibean;
import com.ewanghuiju.app.util.SystemUtil;

/**
 * @author sj  qq:751943509
 * @class describe
 * @time 2020/2/20
 */
public class IconTitleAdapter extends BaseQuickAdapter<Bibeibean, BaseViewHolder> {
    private int mType;

    public IconTitleAdapter(int layoutResId, int type) {
        super(layoutResId);
        this.mType = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, Bibeibean item) {
        helper.setText(R.id.tv_item_name, item.getTitle());
        ImageView iv = helper.getView(R.id.im_item_icon);
        if (mType == 1) {
//            iv.getLayoutParams().width = SystemUtil.dp2px(mContext,40);
//            iv.getLayoutParams().height = SystemUtil.dp2px(mContext,40);
        iv.setImageResource(item.getImg());
        }else{
            ImageLoader.load(mContext, item.getImg(), iv);
        }
//        ImageLoader.load(mContext, item.getImg(), iv);
//        Glide.with(mContext).load(item.getImg()).into(iv);
    }
}
